﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Sto8a00
    {
		private string _listid;
		private string _docno;
		private string _doctype;
        private DateTime? _docdate;
		private string _changecode;
		private string _supplierid;
		private string _refid;
		private string _refdocno;
		private string _refdocno1;
		private string _refdocno2;
        private DateTime? _docdate1;
        private DateTime? _docdate2;
		private string _warehouseid;
        private int? _docstatus;
		private string _audstatus;
		private double _totalqty;
		private double _adjustqty;
		private double _docqty1;
		private double _docqty2;
		private double _totalamt;
		private double _adjustamt;
		private double _totalamt2;
		private double _totalamt4;
		private double _totalamt3;
		private string _text3;
		private string _text2;
		private string _text1;
		private double _gainamt;
		private double _gainpct;
		private string _taxid;
		private double _dutyamt;
		private double _agio1;
		private double _agio2;
		private double _agio3;
		private string _remark1;
		private string _remark2;
		private string _usercode;
		
        /// <summary>
        /// 主键ID
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 单据号
        /// </summary>
		public string Docno
		{
			get { return _docno;	 }
			set { _docno=value;	}
		}
        /// <summary>
        /// 单据类型
        /// </summary>
		public string Doctype
		{
			get { return _doctype;	 }
			set { _doctype=value;	}
		}
        /// <summary>
        /// 单据日期
        /// </summary>
		public DateTime? Docdate
		{
			get { return _docdate;	 }
			set { _docdate=value;	}
		}
        /// <summary>
        /// 验证码
        /// </summary>
		public string Changecode
		{
			get { return _changecode;	 }
			set { _changecode=value;	}
		}
        /// <summary>
        /// 供应商
        /// </summary>
		public string Supplierid
		{
			get { return _supplierid;	 }
			set { _supplierid=value;	}
		}
        /// <summary>
        /// 相关单据
        /// </summary>
		public string Refid
		{
			get { return _refid;	 }
			set { _refid=value;	}
		}
        /// <summary>
        /// 相关单据号
        /// </summary>
		public string Refdocno
		{
			get { return _refdocno;	 }
			set { _refdocno=value;	}
		}
        /// <summary>
        /// 相关单号1
        /// </summary>
		public string Refdocno1
		{
			get { return _refdocno1;	 }
			set { _refdocno1=value;	}
		}
        /// <summary>
        /// 相关单号2
        /// </summary>
		public string Refdocno2
		{
			get { return _refdocno2;	 }
			set { _refdocno2=value;	}
		}
        /// <summary>
        /// 自定义日期1
        /// </summary>
		public DateTime? Docdate1
		{
			get { return _docdate1;	 }
			set { _docdate1=value;	}
		}
        /// <summary>
        /// 自定义日期2
        /// </summary>
		public DateTime? Docdate2
		{
			get { return _docdate2;	 }
			set { _docdate2=value;	}
		}
        /// <summary>
        /// 仓库
        /// </summary>
		public string Warehouseid
		{
			get { return _warehouseid;	 }
			set { _warehouseid=value;	}
		}
        /// <summary>
        /// 单据状态
        /// </summary>
		public int? Docstatus
		{
			get { return _docstatus;	 }
			set { _docstatus=value;	}
		}
        /// <summary>
        /// 单据审核状态
        /// </summary>
		public string Audstatus
		{
			get { return _audstatus;	 }
			set { _audstatus=value;	}
		}
        /// <summary>
        /// 合计数量
        /// </summary>
		public double Totalqty
		{
			get { return _totalqty;	 }
			set { _totalqty=value;	}
		}
        /// <summary>
        /// 调整数量
        /// </summary>
		public double Adjustqty
		{
			get { return _adjustqty;	 }
			set { _adjustqty=value;	}
		}
        /// <summary>
        /// 自定义数量1
        /// </summary>
		public double Docqty1
		{
			get { return _docqty1;	 }
			set { _docqty1=value;	}
		}
        /// <summary>
        /// 自定义数量2
        /// </summary>
		public double Docqty2
		{
			get { return _docqty2;	 }
			set { _docqty2=value;	}
		}
        /// <summary>
        /// 合计金额
        /// </summary>
		public double Totalamt
		{
			get { return _totalamt;	 }
			set { _totalamt=value;	}
		}
        /// <summary>
        /// 调整金额
        /// </summary>
		public double Adjustamt
		{
			get { return _adjustamt;	 }
			set { _adjustamt=value;	}
		}
        /// <summary>
        /// 合计金额2
        /// </summary>
		public double Totalamt2
		{
			get { return _totalamt2;	 }
			set { _totalamt2=value;	}
		}
        /// <summary>
        /// 合计金额4
        /// </summary>
		public double Totalamt4
		{
			get { return _totalamt4;	 }
			set { _totalamt4=value;	}
		}
        /// <summary>
        /// 合计金额3
        /// </summary>
		public double Totalamt3
		{
			get { return _totalamt3;	 }
			set { _totalamt3=value;	}
		}
        /// <summary>
        /// 自定义字段3
        /// </summary>
		public string Text3
		{
			get { return _text3;	 }
			set { _text3=value;	}
		}
        /// <summary>
        /// 自定义字段2
        /// </summary>
		public string Text2
		{
			get { return _text2;	 }
			set { _text2=value;	}
		}
        /// <summary>
        /// 自定义字段
        /// </summary>
		public string Text1
		{
			get { return _text1;	 }
			set { _text1=value;	}
		}
        /// <summary>
        /// 毛利总额
        /// </summary>
		public double Gainamt
		{
			get { return _gainamt;	 }
			set { _gainamt=value;	}
		}
        /// <summary>
        /// 毛利率
        /// </summary>
		public double Gainpct
		{
			get { return _gainpct;	 }
			set { _gainpct=value;	}
		}
        /// <summary>
        /// 税率
        /// </summary>
		public string Taxid
		{
			get { return _taxid;	 }
			set { _taxid=value;	}
		}
        /// <summary>
        /// 税额
        /// </summary>
		public double Dutyamt
		{
			get { return _dutyamt;	 }
			set { _dutyamt=value;	}
		}
        /// <summary>
        /// 折扣1
        /// </summary>
		public double Agio1
		{
			get { return _agio1;	 }
			set { _agio1=value;	}
		}
        /// <summary>
        /// 折扣2
        /// </summary>
		public double Agio2
		{
			get { return _agio2;	 }
			set { _agio2=value;	}
		}
        /// <summary>
        /// 折扣3
        /// </summary>
		public double Agio3
		{
			get { return _agio3;	 }
			set { _agio3=value;	}
		}
        /// <summary>
        /// 备注1
        /// </summary>
		public string Remark1
		{
			get { return _remark1;	 }
			set { _remark1=value;	}
		}
        /// <summary>
        /// 备注2
        /// </summary>
		public string Remark2
		{
			get { return _remark2;	 }
			set { _remark2=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
		
		public static List<Sto8a00> GetSto8a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Sto8a00> list = new List<Sto8a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Sto8a00 model = GetSto8a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Sto8a00 GetSto8a00ByDataRow(DataRow dr)
		{
			Sto8a00 model = new Sto8a00(); //实例化Sto8a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			if (dcc.Contains("docno")&&!(dr["docno"] is System.DBNull))  
				model.Docno = ( string)dr["docno"];
			if (dcc.Contains("doctype")&&!(dr["doctype"] is System.DBNull))  
				model.Doctype = ( string)dr["doctype"];
			if (dcc.Contains("docdate")&&!(dr["docdate"] is System.DBNull))  
				model.Docdate = ( DateTime)dr["docdate"];
			if (dcc.Contains("changecode")&&!(dr["changecode"] is System.DBNull))  
				model.Changecode = ( string)dr["changecode"];
			if (dcc.Contains("supplierid")&&!(dr["supplierid"] is System.DBNull))  
				model.Supplierid = ( string)dr["supplierid"];
			if (dcc.Contains("refid")&&!(dr["refid"] is System.DBNull))  
				model.Refid = ( string)dr["refid"];
			if (dcc.Contains("refdocno")&&!(dr["refdocno"] is System.DBNull))  
				model.Refdocno = ( string)dr["refdocno"];
			if (dcc.Contains("refdocno1")&&!(dr["refdocno1"] is System.DBNull))  
				model.Refdocno1 = ( string)dr["refdocno1"];
			if (dcc.Contains("refdocno2")&&!(dr["refdocno2"] is System.DBNull))  
				model.Refdocno2 = ( string)dr["refdocno2"];
			if (dcc.Contains("docdate1")&&!(dr["docdate1"] is System.DBNull))  
				model.Docdate1 = ( DateTime)dr["docdate1"];
			if (dcc.Contains("docdate2")&&!(dr["docdate2"] is System.DBNull))  
				model.Docdate2 = ( DateTime)dr["docdate2"];
			if (dcc.Contains("warehouseid")&&!(dr["warehouseid"] is System.DBNull))  
				model.Warehouseid = ( string)dr["warehouseid"];
			if (dcc.Contains("docstatus")&&!(dr["docstatus"] is System.DBNull))  
				model.Docstatus = ( int)dr["docstatus"];
			if (dcc.Contains("audstatus")&&!(dr["audstatus"] is System.DBNull))  
				model.Audstatus = ( string)dr["audstatus"];
			if (dcc.Contains("totalqty")&&!(dr["totalqty"] is System.DBNull))  
				model.Totalqty = Convert.ToDouble(dr["totalqty"]);
			if (dcc.Contains("adjustqty")&&!(dr["adjustqty"] is System.DBNull))  
				model.Adjustqty = Convert.ToDouble(dr["adjustqty"]);
			if (dcc.Contains("docqty1")&&!(dr["docqty1"] is System.DBNull))  
				model.Docqty1 = Convert.ToDouble(dr["docqty1"]);
			if (dcc.Contains("docqty2")&&!(dr["docqty2"] is System.DBNull))  
				model.Docqty2 = Convert.ToDouble(dr["docqty2"]);
			if (dcc.Contains("totalamt")&&!(dr["totalamt"] is System.DBNull))  
				model.Totalamt = Convert.ToDouble(dr["totalamt"]);
			if (dcc.Contains("adjustamt")&&!(dr["adjustamt"] is System.DBNull))  
				model.Adjustamt = Convert.ToDouble(dr["adjustamt"]);
			if (dcc.Contains("totalamt2")&&!(dr["totalamt2"] is System.DBNull))  
				model.Totalamt2 = Convert.ToDouble(dr["totalamt2"]);
			if (dcc.Contains("totalamt4")&&!(dr["totalamt4"] is System.DBNull))  
				model.Totalamt4 = Convert.ToDouble(dr["totalamt4"]);
			if (dcc.Contains("totalamt3")&&!(dr["totalamt3"] is System.DBNull))  
				model.Totalamt3 = Convert.ToDouble(dr["totalamt3"]);
			if (dcc.Contains("text3")&&!(dr["text3"] is System.DBNull))  
				model.Text3 = ( string)dr["text3"];
			if (dcc.Contains("text2")&&!(dr["text2"] is System.DBNull))  
				model.Text2 = ( string)dr["text2"];
			if (dcc.Contains("text1")&&!(dr["text1"] is System.DBNull))  
				model.Text1 = ( string)dr["text1"];
			if (dcc.Contains("gainamt")&&!(dr["gainamt"] is System.DBNull))  
				model.Gainamt = Convert.ToDouble(dr["gainamt"]);
			if (dcc.Contains("gainpct")&&!(dr["gainpct"] is System.DBNull))  
				model.Gainpct = Convert.ToDouble(dr["gainpct"]);
			if (dcc.Contains("taxid")&&!(dr["taxid"] is System.DBNull))  
				model.Taxid = ( string)dr["taxid"];
			if (dcc.Contains("dutyamt")&&!(dr["dutyamt"] is System.DBNull))  
				model.Dutyamt = Convert.ToDouble(dr["dutyamt"]);
			if (dcc.Contains("agio1")&&!(dr["agio1"] is System.DBNull))  
				model.Agio1 = Convert.ToDouble(dr["agio1"]);
			if (dcc.Contains("agio2")&&!(dr["agio2"] is System.DBNull))  
				model.Agio2 = Convert.ToDouble(dr["agio2"]);
			if (dcc.Contains("agio3")&&!(dr["agio3"] is System.DBNull))  
				model.Agio3 = Convert.ToDouble(dr["agio3"]);
			if (dcc.Contains("remark1")&&!(dr["remark1"] is System.DBNull))  
				model.Remark1 = ( string)dr["remark1"];
			if (dcc.Contains("remark2")&&!(dr["remark2"] is System.DBNull))  
				model.Remark2 = ( string)dr["remark2"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			
			return model;
		}
    }
}
